Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustify QED #416

Draft
wants to merge 54 commits into
base: master
Choose a base branch
from
Draft

Rustify QED #416

wants to merge 54 commits into from

Conversation

tgiani
Copy link
Contributor

@tgiani tgiani commented Oct 16, 2024

  • implement aem1.rs, as1aem1.rs, aem2.rs
  • add in anomalous_dimension::unpolarized::spacelike.rs missing QED ingredients
  • hook rust kernels into python
  • benchmark against apfel

@tgiani tgiani marked this pull request as draft October 16, 2024 13:40
@felixhekhorn felixhekhorn added refactor Refactor code rust Rust extension related labels Oct 17, 2024
@felixhekhorn felixhekhorn changed the title [WIP] QED Rustify QED Oct 17, 2024
Comment on lines +49 to +54
/// recursive harmonics
S1ph,
S2ph,
S3ph,
S1p2,
G3p2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we want to keep those - can we inline them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean? Could you please provide an example?

Copy link
Contributor

@felixhekhorn felixhekhorn Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of

    let g3N = c.get(K::G3);
    let g3Np2 = c.get(K::G3p2);

we do

    let g3N = c.get(K::G3);
    let g3Np2 = g3N + f;

where $f = g_3(N+2)-g_3(N)$ is computed analytically beforehand

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid I don t understand. How do you compute f analytically beforehand? Do you mean to move g_functions::g3(self.n + 2., self.get(K::S1p2)) out of the cache?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of the cache?

yes

How do you compute f analytically beforehand?

Mathematica 🙃 let's try to use a short cut: @giacomomagni can you compute quickly this $f$? (also feel free to give your opinion if we should keep that cache entry or not)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I think
$$f = \frac{6 (n+1) (2 n+1) H_n+n \left(-\pi ^2 (n+1)^2-6 n\right)}{6 n^2 (n+1)^3}$$
which I computed half with pen and paper and half Mathematica and checked for $N=1$, $N=2$

to be more precise: for $g_3$ we could use the above equation and for the others we inline the expressions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok thank you! I ll first try to get things working as they are and then I will add this

@felixhekhorn
Copy link
Contributor

We are getting non-sense, but we are running

[...]
Evolution: order: (3, 2), solution strategy: iterate-exact, use fhmruvv: True
Exception ignored in: '<numba.core.cpu.CPUContext object at 0x7facc6476db0>'
Traceback (most recent call last):
  File "/home/felix/.cache/pypoetry/virtualenvs/eko-KkPVjVhh-py3.12/lib/python3.12/site-packages/numba/np/linalg.py", line 827, in _check_finite_matrix
    raise np.linalg.LinAlgError(
numpy.linalg.LinAlgError: Array must not contain infs or NaNs.
Exception ignored in: '<numba.core.cpu.CPUContext object at 0x7facc6476db0>'
Traceback (most recent call last):
  File "/home/felix/.cache/pypoetry/virtualenvs/eko-KkPVjVhh-py3.12/lib/python3.12/site-packages/numba/np/linalg.py", line 827, in _check_finite_matrix
    raise np.linalg.LinAlgError(
numpy.linalg.LinAlgError: Array must not contain infs or NaNs.
Evolution: computing operators - 1/5 took: 6.413625 s
[...]
 ─── 
  g  
 ─── 
       x     Q2  eko  eko_error      apfel  percent_error
0  0.001  10000  NaN        NaN  29.559749            NaN
1  0.010  10000  NaN        NaN   7.916446            NaN
2  0.100  10000  NaN        NaN   0.834144            NaN
3  0.500  10000  NaN        NaN   0.016857            NaN
4  1.000  10000  NaN        NaN   0.000000            NaN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactor code rust Rust extension related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants